import { computed, Ref } from "vue";
import { createNamespacedHelpers, mapState } from "vuex";
import { useStore } from "../store";
import { useMapper } from "./useMapper";

const useState = (type: string, arry: string[]) => {
  const store = useStore();
  let mapFun = mapState;
  if (type) {
    mapFun = createNamespacedHelpers(type).mapState;
  }
  const stroeState = useMapper(mapFun, arry);

  return stroeState;
};

export { useState };
